<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:th="http://www.thymeleaf.org"
   xmlns:winter="http://www.winter.org">
<body>
	<div th:fragment="perfil">
	    <winter:output id="CrearEditarPerfilOutput">
			<div id="BarraNuevoPerfil" class="headerbar" th:if="${perfiles.context.perfil}">
				<div class="form-title" th:text="@{'Perfil'}">Perfil</div>
			    <winter:row>
			    	<winter:column type="col-md-4">
						<winter:inputtext
							id="NuevoPerfilDescripcion" 
							field="*{perfil.descripcion}" 
							label="#{label.common.descripcion}"
							required="true"
							requiredimage="/img/exclamation-small-red.png"
							requiredmessage="#{label.common.descripcion.requerido}" 
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text">
						</winter:inputtext>
						<winter:check
							id="nuevoPerfilSistema" 
							field="*{perfil.perfilSistema}"
							label="#{label.perfil.perfilsistema}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8">
						</winter:check>
					</winter:column>
				</winter:row>
			</div>
			<div id="NuevoPerfilInfoContainer" class="form-container" th:if="${perfiles.context.perfil}">
				<winter:output id="PickListOutput">
					<winter:picklist id="PickList" 
						form="PerfilesForm"
						update="CrearEditarPerfilOutput, PickListOutput"
						source="source, rowStat : ${perfiles.perfil.pickListFunc.pickSource}"
						target="target, rowStat : ${perfiles.perfil.pickListFunc.pickTarget}"
						sourceText ="${source.codigo}"
						sourceValue ="@{${source.id}+'|'+${source.codigo}}"
						targetText ="${target.codigo}"
						targetValue ="@{${target.id}+'|'+${target.codigo}}"
						sourceField ="*{perfil.pickListFunc.pickSourceValue}"
						targetField ="*{perfil.pickListFunc.pickTargetValue}"
						sourcetitle ="@{'Funcionalidades'}"
						targettitle ="@{'Func. Asignadas'}"
						addUrl="@{'/perfiles/addToPickList'}"
						removeUrl="@{'/perfiles/removeFromPickList'}"
						addAllUrl="@{'/perfiles/addAllToPickList'}"
						removeAllUrl="@{'/perfiles/removeAllFromPickList'}"
						showstatus="true"
						object="perfiles"
						events="dblclick"
						style="min-width: 150px;">
					</winter:picklist>
				</winter:output>
				
			    <div class="table-row">
				</div>														
				<winter:row class="button-panel-right" padded="true">
						<winter:ajaxSubmit 
							id="CrearPerfil" 
							form="PerfilesForm" 
							url="@{'/perfiles/guardarPerfil'}" 
							update="PerfilesOutput, CrearEditarPerfilOutput"
							object="perfiles"
							value="#{label.operaciones.guardar}"
							showstatus="true"
							class="btn btn-cyan"
							confirmationrequired="true"
							confirmationtext="Está seguro que desea realizar la operación?"
							process="BarraNuevoPerfil">
						</winter:ajaxSubmit>
						<winter:ajaxSubmit 
							id="CrearPerfilCancelar" 
							form="PerfilesForm" 
							url="@{'/perfiles/cancelar/PERFILES'}"
							update="PerfilesOutput"
							value="#{label.operaciones.cancelar}"
							showstatus="true"
							class="btn btn-danger"
							process="BarraNuevoPerfil"
							immediate="true">
						</winter:ajaxSubmit>
				</winter:row>
			</div>		
		</winter:output>
	</div>
</body>
</html>